<?php
include dirname(__FILE__) . "/../config/functions.php";

$optionsQuery = mysql_query("SELECT * FROM `option`");
while($row = mysql_fetch_assoc($optionsQuery))    $options[$row['key']] = $row['value'];

?>
<!doctype html> 
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title><?= $options['site_name'] ?></title>
        <meta property="og:title" content="<?= $options['site_name'] ?>">
        <meta property="og:site_name" content="<?= $options['site_name'] ?>">
        <meta property="og:type" content="<?= $options['type'] ?>">
        <meta property="og:url" content="<?= $options['url'] ?>">
        <meta property="og:image" content="<?= $options['image'] ?>">
        <meta property="fb:admins" content="<?= $options['admins'] ?>">
        <meta name="description" content="<?= $options['site_description'] ?>">
        <meta name="keywords" content="<?= $options['keywords'] ?>">
        <meta name="author" content="<?= $options['author'] ?>">
        <meta name="Robots" content="<?= $options['Robots'] ?>">
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
        <link href="../css/bootstrap.min.css" rel="stylesheet"/>
        <link href="../css/style.css" rel="stylesheet"/>
    </head>
    <body>

        <table width="950" height="1" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
            <tr>
                <td background="../images/bg.png">
                    <img src="../images/header.png" alt="Viral Marketing Script - Your MEGA Traffic on Over-Drive!" width="950" height="294" lowsrc="Viral Marketing Script - Your MEGA Traffic on Over-Drive!"></td>
            </tr>
            
            <tr>
                <td background="../images/bg.png"><div align="center"><strong><span class="style4">
                                :: <a href="../index.php">Home</a> 
                                :: <a href="../contact.php">Contact Us</a> 
                                :: <a href="../advertise.php">Advertise</a> 
                                :: <a href="login.php">Login</a> 
                                ::</span></strong></div>
                </td>
            </tr>
            <tr>
                <td background="../images/bg.png">
                    <div align="center">
                        <div style="margin: 7px;"  align='center'> 
                            <?php $_position = 'top'; ?>
                            <?php include dirname(__FILE__) . '/../_banner.php'; ?>
                        </div>
                        <div class="container" style="max-width: 300px;"> 
                            <div class="row"> 
                                <div class="main" style=" margin-bottom: 80px;"> 
                                    <h3 style="color: #808080;font-size: 30px;font-weight: bold;margin-bottom: -16px;">Members Login Area</h3> 
                                    <div class="login-or"> 
                                        <hr class="hr-or"> 
                                    </div> 
                                    <form role="form" method="POST" > 
                                        <?php
                                        require_once dirname(__FILE__) . "/../config/functions.php";
                                        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                                            $username = $_POST['username'];
                                            $password = $_POST['password'];

                                            $user = mysql_query("SELECT * FROM `user` where `username` = '$username' AND `password` = '$password'");
                                            $user = mysql_fetch_assoc($user);
                                            if ($user) {
                                                $_SESSION['member'] = 'admin';
                                                header("Location: home.php");
                                            } else {
                                                echo '<div class="alert alert-danger">Username or passwors wrong.</div>';
                                            }
                                        }
                                        ?>
                                        <div class="form-group"> 
                                            <label for="inputUsernameEmail">Username or email</label> 
                                            <input type="text" name="username" class="form-control" id="inputUsernameEmail"> 
                                        </div> 
                                        <div class="form-group"> 
                                            <label for="inputPassword">Password</label> 
                                            <input type="password" name="password" class="form-control" id="inputPassword">
                                        </div>
                                        <button type="submit" class="btn btn btn-primary"> Log In </button> 
                                    </form>
                                </div> 
                            </div> 
                        </div>
                        <div align='center' style="margin: 25px;"> 
                            <?php $_position = 'bottom'; ?>
                            <?php include dirname(__FILE__) . '/../_banner.php'; ?>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td background="../images/bg.png"><div align="center">
                        <?php include dirname(__FILE__) . '/../footer.php'; ?>
                    </div></td>
            </tr>
            <tr>
                <td>
                    <img src="../images/footer.png" width="950" height="108" alt=""></td>
            </tr>
        </table>
        <script src="../js/jquery-1.10.2.min.js"></script>
        <script src="../js/bootstrap.min.js"></script>

        <!-- End Save for Web Slices -->
    </body>
</html>  
